/*
 * protocol.h
 *
 *  Created on: May 4, 2011
 *      Author: onteria_
 */

#include <unicode/uchar.h>

#ifndef PROTOCOL_H_
#define PROTOCOL_H_

#ifdef	__cplusplus
extern "C" {
#endif

/* General Socket Functions */
int miko_read_data(int socket_descriptor, void * data, uint32_t length, int timeout);
int miko_read_unicode_data(int socket_descriptor, UChar *dest, UChar *buffer, uint32_t size, int timeout);

/* Server Functions */
int process_miko_data(int socket_descriptor, struct Miko * miko, int timeout);
int miko_send_response(int socket_descriptor, int response_code, char * message);

/* Client Functions */
int send_miko_data(int socket_descriptor, struct Miko * miko);
int miko_read_server_response(int socket_descriptor, int timeout, int * response_code, char * message);

/* Utility Functions */
int miko_validate_string(UChar *, uint32_t);
void print_uchar_string(UChar * string);

#ifdef	__cplusplus
}
#endif

#endif /* PROTOCOL_H_ */
